#ifndef     AISINO_DB
#define     AISINO_DB

#include    <string>
#include    <vector>

const std::string AISINO_QUESTION_TAG   =   "q:";
const std::string AISINO_ANSWER_TAG     =   "a:";


class QuestionAndAnswer{
public:
    QuestionAndAnswer(){}
    virtual ~QuestionAndAnswer(){};

public:
    virtual bool isRightAnswer(const std::string& answer) = 0;
    virtual void setAnswerValue(const std::string& answer) = 0;
public:
    bool isQuestionEqual(const std::string& question){ return 0 == this->question.compare(question); }
    void setQuestionValue(const std::string& question){ this->question = question; }

private:
    std::string question;
};

class SingleQA : public QuestionAndAnswer
{
public:
    SingleQA();
    virtual ~SingleQA() override;

public:
    virtual bool isRightAnswer(const std::string& answer) override;
    virtual void setAnswerValue(const std::string& answer) override;

private:
    std::string answer;
};

class MultipleQA : public QuestionAndAnswer
{
public:
    MultipleQA();
    virtual ~MultipleQA() override;

public:
    virtual bool isRightAnswer(const std::string& answer) override;
    virtual void setAnswerValue(const std::string& answer) override;

private:
    std::vector<std::string> answers;
};


class AisinoDB
{
public:
    AisinoDB();
    virtual ~AisinoDB();

public:
    virtual bool loadFile(const std::string& fileName) = 0;

public:
    bool isQuestionAnswer(const std::string& question,const std::string& answer);

protected:
    std::vector<QuestionAndAnswer*> QA_List;
};

class AisinoSingleDB : public AisinoDB
{
public:
    AisinoSingleDB();
    virtual ~AisinoSingleDB() override;

public:
    virtual bool loadFile(const std::string& fileName) override;
};

class AisinoMultipleDB : public AisinoDB
{
public:
    AisinoMultipleDB();
    virtual ~AisinoMultipleDB() override;

public:
    virtual bool loadFile(const std::string& fileName) override;
};

#endif // AISINO_DB
